package com.uyayo.system.rest.controller;

import java.io.IOException;

import javax.servlet.ServletException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.uyayo.system.authority.entity.SysUser;
import com.uyayo.system.authority.service.SysUserService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;


/**
 * 
 * <p>
 * Title: ProfileController
 * </p>
 * <p>
 * Description:会员中心Controller
 * </p>
 * <p>
 * Company: www.lelekeji.com
 * </p>
 * 
 * @author 乐乐科技.胡逢君
 * @date 2016-4-23下午4:03:35
 * @version 1.0
 */
@RestController
@Api("用户的相关Api接口")
@RequestMapping("api/system/user") // 通过这里配置使下面的映射都在/api下，可去除
public class UserController{
	
	private final SysUserService userService;

	@Autowired
	public UserController(SysUserService userService) {
		this.userService = userService;
	}


	@ApiOperation(value="获取用户信息", notes="根据用户id获取用户信息")
	@RequestMapping(value="/{id}", method=RequestMethod.GET)
	public SysUser getUser(@ApiParam(name = "id", value = "用户ID", required = true) @PathVariable(value = "id") String id) throws IOException, ServletException {	
		
		try {
			
			return userService.getUserById(id);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
}
